<template>
  <div class="home">
    <!-- 导航栏 -->
    <div class="header w">
      <div class="logo">
        <img src="../assets/biaozhi.png" alt="" />
      </div>
      <div class="nav">
        <ul>
          <li><router-link to="/">首页</router-link></li>
          <li><router-link to="#">免费课程</router-link></li>
          <li><router-link to="#">项目实战</router-link></li>
          <li><router-link to="#">职业规划</router-link></li>
        </ul>
      </div>
      <div class="search">
        <input type="text" value="记得快忘得慢" />
        <button>搜索</button>
      </div>
      <div class="user">
        <router-link to="#">会员中心</router-link> |
        <router-link to="#">我的学习</router-link> |
        <router-link to="#">登录/注册</router-link>
      </div>
    </div>
    <!-- 导航栏结束 -->
    <div class="main">
      <div class="w">
        <!-- 头 -->
        <div class="main-header">
          <div class="first">
            <router-link to="/">
              首页<i class="el-icon-arrow-right" style="margin-left: 5px"></i>
            </router-link>
            <span style="margin-left: 5px">编程与开发</span>
          </div>

          <div class="second">
            <router-link to="#"
              >编程与开发课程体系<i
                class="el-icon-arrow-right"
                style="margin-left: 5px"
              ></i
            ></router-link>
          </div>
        </div>
        <div class="main-body">
          <div class="third">
            <ul>
              <li>
                <router-link to="#" class="a-active">编程语言</router-link>
              </li>
              <li>
                <router-link to="#">前端开发</router-link>
              </li>
              <li>
                <router-link to="#">后端开发</router-link>
              </li>
              <li>
                <router-link to="#">移动开发</router-link>
              </li>
              <li>
                <router-link to="#">网络与安全</router-link>
              </li>
            </ul>
          </div>
          <div class="main-body-header">
            <h2>微专业</h2>
          </div>
          <div class="main-body-middle">
            <ul v-for="i in IT" :key="i.id">
              <li>
                <img
                  :src="'http://localhost:3000/' + i.image"
                  alt="图片加载失败"
                />
                <a href=""
                  ><h3>{{ i.title }}</h3></a
                >
                <div class="inf">{{ i.card }}</div>
              </li>
            </ul>
          </div>
          <!-- 系列课程开始 -->
          <div class="main-body-header">
            <h2>系列课程</h2>
          </div>
          <div class="main-body-mid">
            <ul v-for="s in seriescourse" :key="s.id">
              <li>
                <img
                  :src="' http://localhost:3000/' + s.image"
                  alt="图片加载失败"
                />
                <router-link :to="{ path: s.path }"
                  ><h3>{{ s.classname }}</h3></router-link
                >

                <div class="time">时间：{{ s.time }}</div>
                <div class="teacher">导师：{{ s.teacher }}</div>
                <div class="info">￥{{ s.price }}</div>
              </li>
            </ul>
          </div>
        </div>
        <!-- 微专业结束 -->
      </div>
    </div>
    <!-- 中间部分结束 -->
    <!-- 底部 -->
    <div class="footer">
      <div class="w">
        <div class="title">
          <ul>
            <li><router-link to="#">关于我们</router-link></li>
            <li><router-link to="#">联系我们</router-link></li>
            <li><router-link to="#">帮助中心</router-link></li>
            <li><router-link to="#">客户服务</router-link></li>
            <li><router-link to="#">新手指南</router-link></li>
            <li><router-link to="#">合作机构</router-link></li>
            <li><router-link to="#">合作导师</router-link></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      IT: [],
      seriescourse: [],
    };
  },
  created() {
    this.queryIT();
    this.querySeriescourse();
  },
  methods: {
    queryIT() {
      this.axios
        .get("http://localhost:3000/IT")
        .then((response) => {
          this.IT = response.data;
        })
        .catch((error) => {
          console.log(error);
        });
    },
    querySeriescourse() {
      this.axios
        .get("http://localhost:3000/seriescourse")
        .then((response) => {
          this.seriescourse = response.data;
        })
        .then((error) => {
          console.log(error);
        });
    },
  },
};
</script>
<style>
* {
  margin: 0;
  padding: 0;
}
.w {
  width: 1200px;
  margin: auto;
}
.header {
  height: 42px;
  /* 上下30 */
  margin: 30px auto;
}
/* 去除li样式 */
li {
  list-style: none;
}
/* 去除所有a链接下划线 */
a {
  text-decoration: none;
  color: #050505;
}
.logo {
  float: left;
  width: 198px;
  height: 42px;
}
.logo img {
  width: 198px;
  height: 42px;
}
.nav {
  float: left;
  margin-left: 10px;
}
.nav ul li {
  float: left;
}
.nav ul li a {
  display: block;
  height: 42px;
  /* 上下给0 左右给10 */
  padding: 0 10px;
  /* 垂直居中 */
  line-height: 42px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  color: #050505;
}
/* 鼠标划过 下划线 */
.nav ul li a:hover {
  border-bottom: 2px solid rgb(255, 63, 41);
  color: rgb(255, 63, 41);
}
.search {
  float: left;
  width: 412px;
  height: 42px;
  margin-left: 15px;
}
.search input {
  float: left;
  width: 320px;
  height: 40px;
  border: 1px solid rgb(255, 63, 41);
  /* 将边框右设为0 */
  border-right: 0;
  color: #bfbfbf;
  font-size: 14px;
  padding-left: 15px;
  border-radius: 5px 0 0 5px;
  /* 去除被点击时的黑框 */
  outline: none;
}
.search button {
  float: left;
  width: 70px;
  height: 42px;
  background-color: rgb(255, 63, 41);
  border: 0;
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  border-radius: 0 5px 5px 0;
}
.user a {
  line-height: 42px;
  color: #050505;
}
.user a:hover {
  color: rgb(255, 63, 41);
}

/* 中间部分开始 */
.main {
  height: 1700px;
  background-color: rgb(242, 242, 242);
}
.main-header {
  height: 45px;
  /* background-color: pink; */
}

.main-header span {
  color: rgb(153, 153, 153);
}
.main-header .first {
  float: left;
  width: 170px;
  height: 40px;
  line-height: 40px;
}
.main-header .second {
  float: right;
  width: 170px;
  height: 40px;
  line-height: 40px;
  background-color: rgb(245, 225, 223);
}
.main-header .second a {
  color: rgb(255, 63, 41);
}
.main-body .third {
  height: 30px;
  /* background-color: red; */
}
.a-active {
  color: rgb(255, 63, 41) !important;
}
.main-body .third ul li {
  float: left;
  margin-left: 20px;
}
.main-body .third ul li a {
  color: rgb(102, 102, 102);
}
.main-body .third ul li a:hover {
  color: rgb(255, 63, 41);
}

.main-body-header {
  height: 45px;
}
.main-body-header h2 {
  float: left;
  margin-top: 30px;
  color: #333333;
}
/* 微专业 */
.main-body-middle {
  width: 1220px;
  height: 280px;
  margin-top: 30px;
}
.main-body-middle ul li {
  float: left;
  width: 292px;
  height: 250px;
  margin-top: 15px;
  margin-left: 10px;
  border-radius: 10px;
  /* background-color: pink; */
}
.main-body-middle ul li img {
  width: 292px;
  height: 164.38px;
  border-radius: 5px 5px 0 0;
}
.main-body-middle ul li h3 {
  color: #333333;
  font-weight: 400;
  font-family: Arial, Helvetica, sans-serif;
  margin: 10px 20px 10px 20px;
}
.inf {
  font-family: Arial, Helvetica, sans-serif;
}
/* 系列课程 */
.main-body-mid {
  width: 1220px;
  height: 310px;
  margin-top: 30px;
}
.main-body-mid ul li {
  float: left;
  width: 292px;
  height: 340px;
  margin-top: 15px;
  margin-left: 10px;
  border-radius: 10px;
  background-color: #fff;
}
.main-body-mid ul li img {
  width: 292px;
  height: 164.38px;
  border-radius: 5px 5px 0 0;
}
.main-body-mid ul li h3 {
  color: #333333;
  font-weight: 400;
  font-family: Arial, Helvetica, sans-serif;
  margin: 10px 20px 25px 20px;
  text-align: left;
}
.time {
  text-align: left;
  margin: 10px 20px 10px 20px;
  font-size: 13px;
  color: #666666;
}
.teacher {
  text-align: left;
  font-size: 13px;
  margin: 10px 20px 10px 20px;
  color: #666666;
  border-bottom: 1px solid rgb(240, 240, 240);
  padding: 0 0 14px;
}
.info {
  text-align: right;
  margin: 10px 20px 10px 20px;
  font-size: 22px;
  color: #ff1d00;
}

/* 底部 */
.footer {
  height: 178px;
  background-color: rgb(71, 68, 67);
}
.footer ul li {
  float: left;
}
.footer ul li a {
  color: #fff;
  padding: 20px;
}
.footer .title {
  width: 800px;
  height: 30px;
  /* background-color: red; */
  padding-top: 30px;
}
.footer .title a:hover {
  border-bottom: 2px solid #fff;
}
</style>